<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>QB下载器状态演示</title>
  <style>
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      margin: 0;
      padding: 20px;
      background-color: #f5f5f5;
    }
    
    h1 {
      text-align: center;
      margin-bottom: 20px;
      color: #333;
    }
    
    .container {
      max-width: 1200px;
      margin: 0 auto;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 20px;
    }
    
    .widget-container {
      border: 1px solid #ddd;
      border-radius: 8px;
      overflow: hidden;
      background-color: white;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .widget-title {
      background-color: #f0f0f0;
      padding: 10px;
      font-weight: bold;
      border-bottom: 1px solid #ddd;
    }
    
    .widget-frame {
      width: 100%;
      border: none;
    }
    
    .size-small {
      height: 200px;
    }
    
    .size-medium {
      height: 300px;
    }
    
    .size-large {
      height: 400px;
    }
  </style>
</head>
<body>
  <h1>QB下载器状态组件演示</h1>
  
  <div class="container">
    <div class="widget-container">
      <div class="widget-title">小尺寸 (400×200)</div>
      <iframe src="/widgets/qb-status.html?id=demo-config" class="widget-frame size-small" width="400" height="200"></iframe>
    </div>
    
    <div class="widget-container">
      <div class="widget-title">中尺寸 (500×300)</div>
      <iframe src="/widgets/qb-status.html?id=demo-config" class="widget-frame size-medium" width="500" height="300"></iframe>
    </div>
    
    <div class="widget-container">
      <div class="widget-title">大尺寸 (600×400)</div>
      <iframe src="/widgets/qb-status.html?id=demo-config" class="widget-frame size-large" width="600" height="400"></iframe>
    </div>
  </div>
  
  <script>
    // 创建一个演示配置
    const demoConfig = {
      id: "demo-config",
      name: "演示QB下载器",
      url: "https://qb.example.com:8080",
      username: "admin",
      password: "password",
      updateInterval: 30,
      displayItems: {
        downloadSpeed: true,
        uploadSpeed: true,
        activeDownloads: true,
        activeTorrents: true,
        pausedTorrents: true,
        completedTorrents: true,
        totalTorrents: true,
        globalRatio: true,
        globalDownloaded: true,
        globalUploaded: true,
        freeSpace: true
      }
    };
    
    // 保存演示配置到服务器
    fetch('/api/widgets/qb-status/config', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(demoConfig)
    })
    .then(response => response.json())
    .then(data => {
      console.log('演示配置已保存:', data);
    })
    .catch(error => {
      console.error('保存演示配置失败:', error);
    });
  </script>
</body>
</html> 